<?php
	defined('_JEXEC') or die('Restricted access');
	
	$moduleclass_sfx = $params->get('moduleclass_sfx','');
	
    // Yahoo 1
    $yahooID = trim($params->get('yahooID', ''));
    $nameYahoo = trim($params->get('nameYahoo', ''));
    $telYahoo = trim($params->get('telYahoo', ''));
    $showYahoo = intval($params->get('showYahoo', 1));
    $typeYahoo = intval($params->get('typeYahoo', 2));
	// Yahoo 2
    $yahooID2 = trim($params->get('yahooID2', ''));
    $nameYahoo2 = trim($params->get('nameYahoo2', ''));
    $telYahoo2 = trim($params->get('telYahoo2', ''));
    $showYahoo2 = intval($params->get('showYahoo2', 1));
    $typeYahoo2 = intval($params->get('typeYahoo2', 2));
	// Yahoo 3
    $yahooID3 = trim($params->get('yahooID3', ''));
    $nameYahoo3 = trim($params->get('nameYahoo3', ''));
    $telYahoo3 = trim($params->get('telYahoo3', ''));
    $showYahoo3 = intval($params->get('showYahoo3', 1));
    $typeYahoo3 = intval($params->get('typeYahoo3', 2));
	// Yahoo 4
    $yahooID4 = trim($params->get('yahooID4', ''));
    $nameYahoo4 = trim($params->get('nameYahoo4', ''));
    $telYahoo4 = trim($params->get('telYahoo4', ''));
    $showYahoo4 = intval($params->get('showYahoo4', 1));
    $typeYahoo4 = intval($params->get('typeYahoo4', 2));
    // Skype
    $skypeID = trim($params->get('skypeID', ''));
    $nameSkype = trim($params->get('nameSkype', ''));
    $telSkype = trim($params->get('telSkype', ''));
    $showSkype = intval($params->get('showSkype', 1));
    $typeSkype = trim($params->get('typeSkype', ''));
    // Skype 2
    $skypeID2 = trim($params->get('skypeID2', ''));
    $nameSkype2 = trim($params->get('nameSkype2', ''));
    $telSkype2 = trim($params->get('telSkype2', ''));
    $showSkype2 = intval($params->get('showSkype2', 1));
    $typeSkype2 = trim($params->get('typeSkype2', ''));
    // Social network
    $facebook = trim($params->get('facebook', ''));
    $skype = trim($params->get('skype', ''));
    $linkedin = trim($params->get('linkedin', ''));
    $google = trim($params->get('google', ''));
    $twitter = trim($params->get('twitter', ''));
    $media = trim($params->get('media', ''));
	$hotline = trim($params->get('hotline', ''));
    // Thông tin khác
    $showName = intval($params->get('showName', 1));
    $showTel = intval($params->get('showTel', 0));
?>
<div align="center" class="support_right">
<?php
	if($yahooID != ''){	Xu_ly_yahoo($yahooID, $nameYahoo, $telYahoo, $showYahoo, $typeYahoo, $showName, $showTel); }
	if($yahooID2 != ''){ Xu_ly_yahoo($yahooID2, $nameYahoo2, $telYahoo2, $showYahoo2, $typeYahoo2, $showName, $showTel); }
	if($yahooID3 != ''){ Xu_ly_yahoo($yahooID3, $nameYahoo3, $telYahoo3, $showYahoo3, $typeYahoo3, $showName, $showTel); }
	if($yahooID4 != ''){ Xu_ly_yahoo($yahooID4, $nameYahoo4, $telYahoo4, $showYahoo4, $typeYahoo4, $showName, $showTel); }
	if($skypeID != ''){ Xu_ly_skype($skypeID, $nameSkype, $telSkype, $showSkype, $typeSkype, $showName, $showTel); }
	if($skypeID2 != ''){ Xu_ly_skype($skypeID2, $nameSkype2, $telSkype2, $showSkype2, $typeSkype2, $showName, $showTel); }
?>
	<div class="social_network">
		<?php if($facebook) echo '<a href="'.$facebook.'"><img src="modules/mod_ht_support/images/ico_facebook.png" /></a>' ?>
		<?php if($skype) echo '<a href="'.$skype.'"><img src="modules/mod_ht_support/images/ico_skype.png" /></a>' ?>
		<?php if($linkedin) echo '<a href="'.$linkedin.'"><img src="modules/mod_ht_support/images/ico_in.png" /></a>' ?>
		<?php if($google) echo '<a href="'.$google.'"><img src="modules/mod_ht_support/images/ico_google.png" /></a>' ?>
		<?php if($twitter) echo '<a href="'.$twitter.'"><img src="modules/mod_ht_support/images/ico_twitter.png" /></a>' ?>
		<?php if($media) echo '<a href="'.$media.'"><img src="modules/mod_ht_support/images/ico_media.png" /></a>' ?>
	</div>
</div>

<?php
	function Xu_ly_yahoo($yahooID, $nameYahoo, $telYahoo, $showYahoo, $typeYahoo, $showName, $showTel)
	{
		if($showYahoo==1)
		{ ?>
			<div class="ym_item"><a href="ymsgr:sendIM?<?php echo $yahooID ?>">
			<img title="" alt="" src="http://opi.yahoo.com/online?u=<?php echo $yahooID; ?>&amp;m=g&amp;t=<?php echo $typeYahoo; ?>" border="0">
			</a>
			<?php if($showName==1){ ?>
			<div class="sitem-name"><?php echo $nameYahoo;  ?> </div>
			<?php } if($showTel==1){ ?>
			<div class="sitem-tel"><?php echo $telYahoo;  ?> </div>
			<?php } ?>
			</div>
		<?php 
		}
	}

	function Xu_ly_skype($skypeID, $nameSkype, $telSkype, $showSkype, $typeSkype, $showName, $showTel)
	{
        if($showSkype==1)
		{
			$array_skypeID = split(',',$skypeID);
			$array_nameSkype = split(',',$nameSkype);
			$array_telSkype = split(',',$telSkype);
			$count = count($array_skypeID);
			for($i=0;$i<$count;$i++)
			{
			?>
				<div class="sky_item"><a href="skype:<?php echo trim($array_skypeID[$i]); ?>?call">
				<img title="" src="http://mystatus.skype.com/<?php echo $typeSkype; ?>/<?php echo trim($array_skypeID[$i]); ?>" border="0" ></a>
				<?php if($showName==1){ ?>
				<div><?php echo $array_nameSkype[$i];  ?> </div>
				<?php } if($showTel==1){ ?>
				<div><?php echo $array_telSkype[$i];  ?> </div>
				<?php } ?>
				</div>
			<?php 
			}
		}
	}
?>